<template>
  <router-view />
</template>

<script setup>
const { ref } = require('vue');
const { ipcRenderer } = require('electron');
import moment from 'moment'

const runningTime = ref(localStorage.getItem('runningTime') ? JSON.parse(localStorage.getItem('runningTime')) : {})

import { mainStore } from '@/store/index.js'
const { getConfigJsInfo } = mainStore()
getConfigJsInfo('heyueinfo', { type: 1, lb: "1" })

ipcRenderer.on('running_time', (e, v) => {
  let time = runningTime.value[moment().format('YYYY-MM-DD')]
  runningTime.value[moment().format('YYYY-MM-DD')] = time ? time * 1 + v * 1 : v * 1
  let rt = JSON.stringify(runningTime.value)
  localStorage.setItem('runningTime', rt)
})
ipcRenderer.on('cpu-usage-high-minutes', (e, v) => {
  let time = localStorage.getItem('cputime') * 1 || 0
  time += v
  localStorage.setItem('cputime', time)
})
ipcRenderer.on('networkdetail-log', (e, v) => {
  let networkdetailList = localStorage.getItem('networkdetailList')
  networkdetailList = networkdetailList ? JSON.parse(networkdetailList) : []
  networkdetailList.push(moment().format('YYYY/MM/DD-HH:mm:ss') + v)
  localStorage.setItem('networkdetailList', JSON.stringify(networkdetailList))
})
</script>

<style lang="scss">
@import './assets/font/iconfonMy.css';

@font-face {
  font-family: "calibri";
  src: url('./assets/font/calibri.ttf') format('truetype');
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

*::-webkit-scrollbar {
  display: none;
}

#app {
  background-color: #000;
  color: rgba($color: #fff, $alpha: 1);
  font-family: '宋体';
  font-size: 12px;
  height: 100vh;
  width: 100%;
  position: relative;
}

.btn_style {
  border-radius: 2px;
  background-color: #30353c;
  color: rgba($color: #fff, $alpha: 1);
  border: 1px rgba($color: #fff, $alpha: 0.1) solid;
  text-align: center;
  font-size: 12px;
  line-height: 22px;
  height: 22px;
}
</style>
